package cn.yjh;

import cn.yjh.api.ConfigurationService;
import cn.yjh.client.RPCProxyFactory;



/**
 * @author yW0041229
 * @since 2021/12/14 9:58
 */
public class ClientStarter {

    public static void main(String[] args) throws InterruptedException {
        ConfigurationService rpcProxy = null;
        rpcProxy = RPCProxyFactory.getRPCProxy(ConfigurationService.class, "127.0.0.1", 2088);
        rpcProxy.updateConfiguration("OK");
        /*long l = System.currentTimeMillis();
        for(int i=0;i<5000;i++) {
            rpcProxy = RPCProxyFactory.getRPCProxy(ConfigurationService.class, "127.0.0.1", 2088);
            boolean b = rpcProxy.updateConfiguration("OK");
            System.out.println(i+"================"+b);
        }
        System.out.println("总共耗时："+(System.currentTimeMillis()-l));*/
        /*ThreadPoolExecutor workers = new ThreadPoolExecutor(20, 50, 2, TimeUnit.SECONDS, new ArrayBlockingQueue<>(50),new ThreadPoolExecutor.DiscardPolicy());
        while (true){
            for(int i=0;i<20;i++){
                workers.execute(()->{
                    ConfigurationService rpcProxy1 = RPCProxyFactory.getRPCProxy(ConfigurationService.class, "127.0.0.1", 2088);
                    rpcProxy1.updateConfiguration("new Configuration()");
                });
            }
            TimeUnit.MILLISECONDS.sleep(200);
        }*/


    }
}
